﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using OpenCvSharp;

namespace IMCOM.Imagiality.Core
{
    public class GenericImage
    {
        private IplImage image;
        private Rectangle regionOfInterest;

        private IplImage Image
        {
            get { return image; }
            set { image = value; RegionOfInterest = new Rectangle(new Point(0, 0), new Size(value.Width, value.Height)); }
        }

        public Rectangle RegionOfInterest
        {
            get { return regionOfInterest; }
            set { regionOfInterest = value; }
        }

        public GenericImage(String imageFilePath)
        {
            Image = new IplImage(imageFilePath, LoadMode.Color);
        }

        public GenericImage(Bitmap bitmap)
        {
            Image = BitmapConverter.ToIplImage(bitmap);
        }

        public GenericImage(IplImage image)
        {
            Image = image;
        }
        
        public Bitmap getBitmap()
        {
            return Image.ToBitmap();
        }

        public IplImage getIplImage()
        {
            return image;
        }
    }
}
